package com.group56.viewmodel.dto;

import com.group56.model.entity.Video;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;

public class VideoDTO {
    private StringProperty name;
    private StringProperty videoUrl;
    private StringProperty picUrl;
    private StringProperty categories;
    private StringProperty description;
    private StringProperty price;
    public VideoDTO(Video video){
        this.name=new SimpleStringProperty(video.getName());
        this.videoUrl=new SimpleStringProperty(video.getVideoUrl());
        this.picUrl=new SimpleStringProperty(video.getPicUrl());
        this.categories=new SimpleStringProperty(video.getCategories());
        this.description=new SimpleStringProperty(video.getDescription());
        this.price=new SimpleStringProperty(video.getPrice());
    }
    public VideoDTO(String name,String videoUrl,String picUrl,String categories,String description, String price){
        this.name=new SimpleStringProperty(name);
        this.videoUrl=new SimpleStringProperty(videoUrl);
        this.picUrl=new SimpleStringProperty(picUrl);
        this.categories=new SimpleStringProperty(categories);
        this.description=new SimpleStringProperty(description);
        this.price=new SimpleStringProperty(price);
    }
    public void updateVideo(Video video){
        this.name.set(video.getName());
        this.videoUrl.set(video.getVideoUrl());
        this.picUrl.set(video.getPicUrl());
        this.categories.set(video.getCategories());
        this.description.set(video.getDescription());
        this.price.set(video.getPrice());
    }
    public Video parseVideo(){
        Video video=new Video();
        video.setName(this.name.get());
        video.setVideoUrl(this.videoUrl.get());
        video.setPicUrl(this.picUrl.get());
        video.setCategories(this.categories.get());
        video.setDescription(this.description.get());
        video.setPrice(this.price.get());
        return video;
    }

    @Override
    public String toString() {
        return "VideoDTO{" +
                "name=" + name +
                ", videoUrl=" + videoUrl +
                ", picUrl=" + picUrl +
                ", categories=" + categories +
                ", description=" + description +
                ", price=" + price +
                '}';
    }

    public String getName() {
        return name.get();
    }

    public StringProperty nameProperty() {
        return name;
    }

    public void setName(String name) {
        this.name.set(name);
    }

    public String getVideoUrl() {
        return videoUrl.get();
    }

    public StringProperty videoUrlProperty() {
        return videoUrl;
    }

    public void setVideoUrl(String videoUrl) {
        this.videoUrl.set(videoUrl);
    }

    public String getPicUrl() {
        return picUrl.get();
    }

    public StringProperty picUrlProperty() {
        return picUrl;
    }

    public void setPicUrl(String picUrl) {
        this.picUrl.set(picUrl);
    }

    public String getCategories() {
        return categories.get();
    }

    public StringProperty categoriesProperty() {
        return categories;
    }

    public void setCategories(String categories) {
        this.categories.set(categories);
    }

    public String getDescription() {
        return description.get();
    }

    public StringProperty descriptionProperty() {
        return description;
    }

    public void setDescription(String description) {
        this.description.set(description);
    }

    public String getPrice() {
        return price.get();
    }

    public StringProperty priceProperty() {
        return price;
    }

    public void setPrice(String price) {
        this.price.set(price);
    }
}
